<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:75:"E:\phpStudy\PHPTutorial\WWW\thinkphp\cltphp/app/admin\view\wechat\text.html";i:1504236000;s:75:"E:\phpStudy\PHPTutorial\WWW\thinkphp\cltphp/app/admin\view\common\head.html";i:1505459050;s:75:"E:\phpStudy\PHPTutorial\WWW\thinkphp\cltphp/app/admin\view\common\foot.html";i:1503623995;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo config('sys_name'); ?>后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="__STATIC__/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="__ADMIN__/css/global.css" media="all">
    <link rel="stylesheet" href="__STATIC__/common/css/font.css" media="all">
</head>
<body class="skin-0">
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>文本回复</legend>
    </fieldset>
    <blockquote class="layui-elem-quote">
        <a href="<?php echo url('addText'); ?>" class="layui-btn layui-btn-small"><?php echo lang('add'); ?>文本回复</a>
    </blockquote>
    <table class="layui-table" id="list" lay-filter="list"></table>
</div>
<script type="text/javascript" src="__STATIC__/plugins/layui/layui.js"></script>


<script type="text/html" id="action">
    <a href="<?php echo url('editText'); ?>?id={{d.id}}" class="layui-btn layui-btn-mini">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="del">删除</a>
</script>
<script>
    layui.use('table', function() {
        var table = layui.table;
        $ = layui.jquery;
        var tableIn = table.render({
            id: 'menu',
            elem: '#list',
            url: '<?php echo url("text"); ?>',
            method: 'post',
            page:true,
            cols: [[
                {field: 'id', title: '<?php echo lang("id"); ?>', width: 80, fixed: true},
                {field: 'keyword', title: '关键词', width: 120, templet: '#name'},
                {field: 'text', title: '回复', width: 400},
                {width: 160, align: 'center', toolbar: '#action', title: '操作'}
            ]],
            limit:10
        });
        table.on('tool(list)', function(obj) {
            var data = obj.data;
            if(obj.event === 'del'){
                layer.confirm('您确定要删除该内容吗？', function(index){
                    var loading = layer.load(1, {shade: [0.1, '#fff']});
                    $.post("<?php echo url('delText'); ?>",{id:data.id},function(res){
                        layer.close(loading);
                        if(res.code===1){
                            layer.msg(res.msg,{time:1000,icon:1});
                            tableIn.reload();
                        }else{
                            layer.msg('操作失败！',{time:1000,icon:2});
                        }
                    });
                    layer.close(index);
                });
            }
        });
    });
</script>